style context: Trivial refactor
authorMatthias Clasen <mclasen@redhat.com>
Sat, 19 Sep 2015 05:15:39 +0000 (01:15 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 23 Sep 2015 11:01:14 +0000 (07:01 -0400)
Use g_set_object for setting the frame clock.

gtk/gtkstylecontext.c

index c795cc0827adebe5144fdaedf61efa7874824feb..f37b50cc10ef55e3a6ad46d76c8c40b4c682f374 100644 (file)
@@ -2026,22 +2026,11 @@ void
 gtk_style_context_set_frame_clock (GtkStyleContext *context,
                                    GdkFrameClock   *frame_clock)
 {
-  GtkStyleContextPrivate *priv;
-
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
   g_return_if_fail (frame_clock == NULL || GDK_IS_FRAME_CLOCK (frame_clock));
 
-  priv = context->priv;
-  if (priv->frame_clock == frame_clock)
-    return;
-
-  if (priv->frame_clock)
-    g_object_unref (priv->frame_clock);
-  priv->frame_clock = frame_clock;
-  if (priv->frame_clock)
-    g_object_ref (priv->frame_clock);
-
-  g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_FRAME_CLOCK]);
+  if (g_set_object (&context->priv->frame_clock, frame_clock))
+    g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_FRAME_CLOCK]);
 }
 
 /**